﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.RbacData.Infrastructure
{
    /// <summary>
    /// 仓储接口
    /// </summary>
    /// <typeparam name="T">泛型</typeparam>
    public interface IBaseRepository<T>
    {

        /// <summary>
        /// 查询所有
        /// </summary>
        /// <returns>返回实现</returns>
        IQueryable<T> GetAll();

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns>返回实现</returns>
        Task<int> AddAsync(T entity);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns>返回实现</returns>
        Task<int> UpdateAsync(T entity);

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="ids">要删除的实体对象列表</param>
        /// <returns>返回受影响的行数，表示成功删除的记录数</returns>
        Task<int> DeltelAll(List<T> ids);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="entity">实体集合</param>
        /// <returns>返回受影响行数</returns>
        Task<int> UpdateRanger(List<T> entity);
    }
}
